package me.jtx.poplar.article.model.entity;

import java.io.Serializable;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import me.jtx.poplar.article.Key;
import me.jtx.poplar.core.data.JpaEntity;

/**
 * Article
 *
 * @author: Tong Huazhong(jsyzthz@gmail.com)
 * @copyright: &copy; 2016, Tong Huazhong
 */
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@XmlRootElement(name = Key.user)
public class Article extends JpaEntity<UUID> implements Serializable {
	private static final long serialVersionUID = -8437087189559088704L;

	/**
	 * Title
	 */
	private String title;
	/**
	 * Summary
	 */
	private String summary;
	/**
	 * Content
	 */
	private String content;
	/**
	 * Friendly name
	 */
	private String entryName;

	@XmlElement
	@NotNull
	@Length(min = 1, max = 100)
	@NotBlank
	@Column
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@XmlElement
	@Length(max = 400)
	@Column
	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@XmlElement
	@NotNull
	@NotBlank
	@Column
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@XmlElement
	@NotNull
	@Length(min = 1, max = 150)
	@NotBlank
	@Column
	public String getEntryName() {
		return entryName;
	}

	public void setEntryName(String entryName) {
		this.entryName = entryName;
	}
}
